<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>课题审核</title>
</head>
<%@ include file="/module/js.jsp"%>
	<script type="text/javascript">
			$(document).ready(function() {
				//查询所有的活动信息
				$('#researchProjectAuditing').datagrid({
					   rowStyler: function(index,row){
					   },
					   onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
							if (data.rows.length > 0) {
							}
						},
				});
				
				//条件查询
				$('#btnQuery').click(function() {
					$('#researchProjectAuditing').datagrid('load',{
						KSID : $('#KSID').val(),
						TGID : $('#TGID').val(),
						empName: $('#empName').val(),
						empId : $('#empId').val(),
						subject: $('#subject').val(),
						kTLB: $('#kTLB').val(),
						beginTime : $('#beginTime').val(),
						endTime : $('#endTime').val(),
						curStep: $('input[name="curStep"]:checked').val()
					});
				});
				$('#btnExport').on('click', function(){
					   layer.confirm("您确定要导出吗?", function(index){
						        alert("aaaaa");
								document.Form.action = "${basePath}/researchProjectAuditing/export_df";
								document.Form.submit();
								layer.close(index);
	            		 });
					});
				
		});
	</script>
<body>
	<form action="#" name="demoForm" id="demoForm" method="post">
	<input type="hidden" name="idList" id="idList"/>
	<input type="hidden" name="type" id="type" value="${type}"/>
		<table cellpadding="1" cellspacing="1" border="0">
			<tr>
				<td><input type="button" id="btnQuery" autocomplete="off"  value="查询"
					class="inputButton" /></td>
			 	<td><input type="button" id="btnExport" value="导出"
					class="inputButton" /></td>
			</tr>
		</table>
		<table cellpadding="1" cellspacing="1">
			<tr>
				<td>部门：</td>
				<td>
					<select id="KSID" name="KSID" class="selectList2">
				  		<option value="">全部</option>
					 	<c:forEach items="${departments}" var="department">
					   		<option value="${department.KSID}">${department.KSMC}</option>
						</c:forEach>
					</select>
				</td>
				<td>教研组：</td>
				<td>
					<select id="TGID" name="TGID" class="selectList2">
				  		<option value="">全部</option>
						 <c:forEach items="${teachingGroups}" var="teachingGroup">
					   		<option value="${teachingGroup.TGID}">${teachingGroup.JYZMC}</option>
						</c:forEach> 
					</select>
				</td>
				<td>姓名：</td>
				<td><input type="text" id="empName" name="empName" value="" class="inputText2" /></td>
			</tr>
			<tr>
				<td>工号：</td>
				<td><input type="text" id="empId" name="empId" value="" class="inputText2" /></td>
				<td>标题：</td>
				<td><input type="text" id="subject" name="subject" value="" class="inputText2" /></td>
				<td>类别：</td>
				<td><input type="text" id="kTLB" name="kTLB" value="" class="inputText2" /></td>
			
			</tr>
			<tr>
			   <td>提交日期:</td>
				<td>
				   从<input type="text" name="beginTime" id="beginTime"   autocomplete="off" 
					   class="Wdate inputText2"
					   onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
				</td>
				<td colspan="2">
				 &nbsp;到<input type="text" name="endTime" id="endTime"   autocomplete="off" 
				   class="Wdate inputText2"
					   onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/> 
				</td>
			</tr>
			<tr>
				<td>进度:</td>
			   <td colspan="5">
				   <input name="curStep" id="curStep0" type="radio" checked="checked" value="0"/></input><label for="curStep0"> 全部</label>
				   <input name="curStep" id="curStep1" type="radio" value="1"/><label for="curStep1">填报课题</label>
				   <input name="curStep" id="curStep2" type="radio" value="2"/><label for="curStep2">开题报告</label>
				   <input name="curStep" id="curStep3" type="radio" value="3"/><label for="curStep3">中期报告</label>
				   <input name="curStep" id="curStep4" type="radio" value="4"/><label for="curStep4">结题报告</label>
				   <input name="curStep" id="curStep5" type="radio" value="5"/><label for="curStep5">研究过程及附件</label>
			   </td>
			</tr>
		</table>
		<br/>
		<!-- 需要序号：增加 rownumbers:true-->
		<table id="researchProjectAuditing"  style="width: 100%;"
		data-options="pagination:true,collapsible:true,url:'${basePath}/researchProjectAuditing/listData',method:'post',remoteSort:true">
		<thead>
			<tr>
				<th data-options="field:'kTID',width:10,align:'center',hidden:'ture'"></th>
				<th data-options="field:'subject',sortable:true,nowrap:true,width:150,align:'center',formatter:formater">标题</th>
				<th data-options="field:'kTLB',nowrap:true,width:100,align:'center',sortable:true">类别</th>
				<th data-options="field:'kTSJ',nowrap:true,width:200,align:'center',sortable:true,formatter:formatDate">时间</th>
				<th data-options="field:'curStep',nowrap:true,width:100,align:'center',sortable:true,formatter:curStep">进度</th>
				<th data-options="field:'empName',nowrap:true,width:100,align:'center',sortable:true">提交人</th>
				<th data-options="field:'empId',nowrap:true,width:150,align:'center',sortable:true">工号</th>
				<th data-options="field:'KSMC',nowrap:true,width:100,align:'center',sortable:true">所在部门</th>
				<th data-options="field:'JYZMC',nowrap:true,width:100,align:'center',sortable:true">教研组</th>
				<th data-options="field:'createTime',nowrap:true,width:200,align:'center',sortable:true,formatter:formatDate">提交时间</th>
			</tr>
		</thead>
	</table>              
	</form>
  <script>
    function formater(value, row, index) {
    	var type = $('#type').val();
	       return "<a href='${basePath}/researchProject/premodify?kTID=" + row.kTID + "&type=2'>" + row.subject + "</a>";
	  } 
	    function formatDate(value){
	    	var date=new Date(value);
			var y = date.getFullYear();     
			var m = date.getMonth()+ 1;
			var d = date.getDate();
			var h= date.getHours();       //获取当前小时数(0-23)
			var mm= date.getMinutes();     //获取当前分钟数(0-59)
			var s= date.getSeconds();     //获取当前秒数(0-59)
			return y +'-'+(m <10?('0'+ m):m)+'-'+(d <10?('0'+ d):d)+' :'+(h <10?('0'+ h):h)+':'+(mm <10?('0'+ mm):mm)+':'+(s <10?('0'+ s):s);
		}
    
		//格式化进度
		 function curStep(val,row,index){
			if(row.curStep == 1) {
				return "填报课题";	
			}
			if(row.curStep == 2) {
				return "开题报告";	
			}
			if(row.curStep == 3) {
				return "中期报告";	
			}
			if(row.curStep == 4) {
				return "结题报告";	
			}
			if(row.curStep == 2) {
				return "研究过程及附件";	
			}
			 
		}
     </script>	
</body>
</html>
